<%@ page contentType="text/html;charset=UTF-8"%>
<%@ include file="/WEB-INF/views/include/taglib.jsp"%>
<meta charset="utf-8"></meta>

<head> 
<script type="text/javascript">

$(document).ready(function() { 
	var old_versionId=${version.versionId}; 
	var old_assistId=${version.assistId}; 
	var versionId=${version.versionId}+1;
	var assistId=${version.assistId}+1;  
	
	$("#versionId_new").html(versionId+"."+"0"); 
    $("#RadioVersionId").val(versionId+"."+"0"); 
  
    $("#assistId_new").html(old_versionId+"."+assistId); 
    $("#RadioAssistId").val(old_versionId+"."+assistId);  
    
  
});



function btn_click(){
	var str = $("input[name='versionId']:checked").val();
	if(str==null ||str==""){
		alert("请选择版本号!");
		return;  
	} 
	var versionUrl = "${version.versionUrl}";
	var versionId = "${version.id}";
	var historyId = "${version.historyId}";
	var intAssociatedId = "${intAssociatedId}";
	var contractAttribute ="${contractAttribute}";
	var navId = "${navId}";
	var url = "${contextPath}/"+versionUrl+versionId+"/"+historyId+"/"+intAssociatedId+"/createNewVersion?assistId="+str+"&contractAttribute="+contractAttribute+"&navId="+navId;
	Oosp_Loading('正在导入到合同，请稍等...');
	$.get(url,function(data){
		var obj = eval('(' + data + ')');
		if(obj.success){
			top.$.jBox.tip('导入到合同成功，请进入合同查看页面查看！', 'success');
			$("#insertToContract").hide();
			window.location.reload();//刷新当前页面
s
		}else{
			top.$.jBox.tip('导入到合同失败！');
		}
	});
}
</script>
</head>
<body>
<div class="modal-dialog">
        <div class="modal-content">
            <div class="modal-header">
                <button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button>
                 <h4 class="modal-title">版本管理</h4>
            </div>			<!-- /modal-header -->
            <div class="modal-body">
         	 	  <form class="form-signin" role="form" action=""  id="form" method="post">
						  	<table class="table table-bordered">
							  <tbody>
							  	<tr>
							  		<td class="text-right" style="width: 20%"><strong>请选择版本号</strong></td>
							  		<td> 
							  			<input type="radio" name="versionId" checked="checked" value="" id="RadioVersionId" />  <span id="versionId_new"></span>
							  		    <input type="radio" name="versionId" value="" id="RadioAssistId"/>  <span id="assistId_new"></span> 
							  		</td>
							  	</tr>
							   <tr>
							  		<td class="text-right" style="width: 20%"></td>
							  		<td><strong>此操作是创建一个新版本的文档，请谨慎使用!</strong></td>
							  	</tr>
	
							  </tbody>
							</table>
							</form>
            </div>			
            <!-- /modal-body -->
            <div class="modal-footer">
                <button type="button" data-dismiss="modal" onclick="btn_click()"  class="btn btn-primary" onclick="">确定</button>
                 <button type="button"  class="btn btn-default" data-dismiss="modal">关闭</button>
            </div>			
            <!-- /modal-footer -->
        </div>         
        <!-- /modal-content -->
    </div>     
   <!-- /modal-dialog -->
   
</body>